package org.springframework.security.core.authority;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xkcoding.rbac.security.model.Permission;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class PermissionGrantedAuthority implements GrantedAuthority {

    private Permission permission;

    @Override
    @JsonIgnore
    public String getAuthority() {
        return permission.getPermission();
    }

}
